package interfaces.options;

import interfaces.GUISource;

import org.fenggui.Slider;
import org.fenggui.decorator.background.PlainBackground;
import org.fenggui.util.Color;

import fileHandling.language.Lang;

public class SliderOptionWidget extends OptionWidget {
	
	private Slider slider;
	
	public SliderOptionWidget(String initValue, Lang description) {
		super(description, initValue);
		slider = new Slider(true);
		GUISource.setTheme(slider);
		slider.setValue(Float.valueOf(initValue).floatValue());
		slider.setVisible(true);
		slider.getAppearance().add(new PlainBackground(Color.BLUE));
		addWidget(slider);
	}
	
	@Override
	public String getValue() { return slider.getValue() + ""; }
	
	@Override
	public void setToHigh() { changeValue(1f + ""); }
	
	@Override
	public void setToMedium() { changeValue(0.5f + ""); }
	
	@Override
	public void setToLow() { changeValue(0f + ""); }
	
	@Override
	public void changeValue(String value) { slider.setValue(Double.valueOf(value).doubleValue()); }
}